﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Eagle.Web.TagFactory
{
    /// <summary>
    /// 生成TextArea
    /// </summary>
    public class TextArea
    {
        /// <summary>
        /// 生成 textarea 的标签
        /// </summary>
        /// <param name="name">标签名称</param>
        /// <param name="createId">是否生成标签的Id</param>
        /// <param name="value">该标签的值</param>
        /// <param name="cols">列数</param>
        /// <param name="rows">行数</param>
        /// <param name="className">样式</param>
        /// <param name="properties">标签的其他属性</param>
        /// <returns></returns>
        public static string Create(string name, bool createId, string value,int cols,int rows,string className, string properties)
        {
            string htmlTag = string.Empty;
            if (createId)
            { if(className.Length>0)
                return "<textarea  name=\"" + name + "\" id=\"" + name + "\" cols=\""+cols+"\" rows=\""+rows+"\" class=\""+className+"\" " + properties + " >" + value + "</textarea>";
                htmlTag = "<textarea  name=\"" + name + "\" id=\"" + name + "\" cols=\""+cols+"\" rows=\""+rows+"\" " + properties + " >" + value + "</textarea>"; }
            else
            { 
                if(className.Length>0)
                    return "<textarea  name=\"" + name + "\" cols=\"" + cols + "\" rows=\"" + rows + "\" " + properties + " >" + value + "</textarea>";
                htmlTag = "<textarea  name=\"" + name + "\" " + properties + " >" + value + "</textarea>"; }
            return htmlTag;
        }

        /// <summary>
        /// 生成 textarea 的标签
        /// </summary>
        /// <param name="name">标签名称</param>
        /// <param name="createId">是否生成标签的Id</param>
        /// <param name="value">该标签的值</param>
        /// <param name="cols">列数</param>
        /// <param name="rows">行数</param>
        /// <returns></returns>
        public static string Create(string name, bool createId, string value, int cols, int rows)
        {
            return Create(name, createId, value, cols, rows, "", "");
        }
    }
}
